|
|
 |
|
|
|
|
picCanvas.AutoRedraw = True
picCanvas.Line (0, 0)(1440, 1440), B
picCanvas.AutoRedraw = picCanvas.Picture |
|
|
|
|
|
|
|
|
You can also set a drawing object's Picture property directly from a file using the LoadPicture statement. |
|
|
|
|
|
|
|
|
An object can also have a valid Picture property and still not have a logical palette. If an object uses only static colors, the system does not bother to create a palette for the object. Later, when you draw on the object, the system knows that a picture without a palette needs to use only the static colors. While this sort of object has a valid Picture property, the value of the hPal property is zero. You can examine this value without causing an error, but you cannot use it as a parameter to API functions that manipulate palettes. |
|
|
|
|
|
|
|
|
Once you have assigned a picture with a palette to a Picture object, you can use the Picture's hPal property to manipulate the palette. |
|
|
|
|
|
|
|
|
As you might guess from its name, the ResizePalette function allows you to change a logical palette's size. If you use this function to make a palette larger, the new entries are initially set to black. ResizePalette takes as parameters a handle to the logical palette and the number of entries you want the palette to have. The function returns zero if there is an error and a nonzero value otherwise. |
|
|
|
 |
|
|
|
|
Private Declare Function ResizePalette Lib "gdi32" _
Alias "ResizePalette" (ByVal hPalette As Long, _
ByVal nNumEntries As Long) As Long |
|
|
|
|
|
|
|
|
Examining Palette Entries |
|
|
|
|
|
|
|
|
You can use the GetPaletteEntries function to find out exactly what color values are loaded in a logical palette. This function takes as parameters a handle to the palette, the index of the first entry in the palette that you want to examine, the number of palette entries you want to examine, and an array of PALETTEENTRY structures. The function fills in the peRed, peGreen, and peBlue fields in the PALETTEENTRY structures to indicate the red, green, and blue components of the colors. The function returns the number of palette entries for which it retrieved information. |
|
|
|
 |
|
|
|
|
Private Type PALETTEENTRY
peRed As Byte
peGreen As Byte
peBlue As Byte
peFlags As Byte
End Type
Private Declare Function GetPaletteEntries Lib "gdi32" _
Alias "GetPaletteEntries" (ByVal hPalette As Long, _ |
|
|
|
|
|